//
//  ZSelectView.m
//  ZZBlue
//
//  Created by stonesMonkey on 2017/9/12.
//  Copyright © 2017年 stonesMonkey. All rights reserved.
//

#import "ZSelectView.h"

@interface ZSelectView()

@property (weak, nonatomic) IBOutlet UIButton *playerBtn;


@property (nonatomic, assign) ZSelectPlayModel currentModel;


@property (weak, nonatomic) IBOutlet UIButton *playModelBtn;

@end

@implementation ZSelectView

- (IBAction)playModel:(id)sender {
    
    
    
    self.currentModel = (++self.currentModel) % 3;
    switch (self.currentModel) {
        case ZSelectPlayModelLoop:
        {
            [self.playModelBtn setBackgroundImage:[UIImage imageNamed:@"icon_music_xh"] forState:UIControlStateNormal];
        }
            break;
        case ZSelectPlayModelSingle:
        {
             [self.playModelBtn setBackgroundImage:[UIImage imageNamed:@"icon_music_dq"] forState:UIControlStateNormal];
        }
            break;
        case ZSelectPlayModelRandom:
        {
                [self.playModelBtn setBackgroundImage:[UIImage imageNamed:@"icon_music_sj"] forState:UIControlStateNormal];
        }
            break;
            
        default:
            break;
    }
    
    
    if (self.playModel) {
        
        self.playModel(self.currentModel);
    }
}

- (IBAction)preMusic:(UIButton *)sender {
    
    
    if (self.preMusic) {
        
        self.preMusic();
    }
   
}

- (IBAction)pauseMusic:(UIButton *)sender {
    
    sender.selected = !sender.selected;
    if (self.pauseMusic) {
        
        self.pauseMusic(sender.selected);
    }
}

- (IBAction)nextBtn:(UIButton *)sender {
    
    if (self.nextMusic) {
        
        self.nextMusic();
    }
}

- (IBAction)musicList:(id)sender {
    
    if (self.listMusic) {
        
        self.listMusic();
    }
}

- (void)setIsPlayer:(BOOL)isPlayer {
    
    self.playerBtn.selected = isPlayer;
}
@end
